<template>
  <div class="list-container">
    <div class="list-main">
      <div class="list-nav">
        <div class="list-nav-title">
          <span>统计导航</span><i class="fa fa-outdent" />
        </div>
        <!-- @node-click="selectClick" @check-change="selectClick"-->
        <el-tree
          :data="treeData"
          show-checkbox
          default-expand-all
          node-key="id"
          ref="tree"
          highlight-current
          :props="defaultProps"
          @check="selectClick"
        >
        </el-tree>
      </div>
      <div class="content">
        <div class="contentCon">
          <div class="contentTitleCon">
            <div class="spaceCon"></div>
            <div
              class="contentTitle"
              v-for="(item, index) in getCheckedKeys"
              :key="index"
            >
              {{ formatData[item] }}
            </div>
          </div>

          <div
            class="contentItem"
            :style="{ width: 852 / ratioList.length + 'px' }"
            v-for="(item, index) in ratioList"
            :key="index"
          >
            <div class="contentItemTitle">{{ item.申请号 }}</div>
            <div class="contentItemShow">
              <div class="msg">
                <span class="left">专利号：</span>
                <span class="right">{{ item.申请号 }}</span>
              </div>
              <div class="msg">
                <span class="left">专利名称：</span>
                <span class="right">{{ item.发明创造名称 }}</span>
              </div>
            </div>
            <div
              class="contentItemTxt"
              v-for="(res, i) in getCheckedKeys"
              :key="i"
            >
              {{ item[res] }}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { lableCases, queryCaseLables } from "@api/details";
export default {
  name: "Left",
  data() {
    return {
      leftList: [],
      treeData: [
        {
          id: 1,
          label: "对比维度",
          children: [
            {
              id: "anliqw",
              label: "案例全文"
            },
            {
              id: "anyou",
              label: "案由"
            },
            {
              id: 5,
              label: "决定的理由",
              children: [
                {
                  id: "falvsy",
                  label: "法律适用"
                },
                {
                  id: "zhengjurd",
                  label: "证据认定"
                },
                {
                  id: "falvwtps",
                  label: "法律问题评述"
                }
              ]
            },
            {
              id: "jueding",
              label: "决定"
            }
          ]
        }
      ],
      defaultProps: {
        children: "children",
        label: "label"
      },
      formatData: {
        zhuanlih: "专利号",
        zhuanlimc: "专利名称",
        juedngh: "决定号",
        anliqw: "案例全文",
        anyou: "案由",
        falvsy: "法律适用",
        zhengjurd: "证据认定",
        falvwtps: "法律问题评述	",
        jueding: "决定"
      },
      contentData: [],
      ratioList: [],
      getCheckedKeys: []
    };
  },
  mounted() {
    console.log(sessionStorage.getItem("ratioDetail"));
    this.ratioList = JSON.parse(sessionStorage.getItem("ratioList"));
    this.contentData = JSON.parse(sessionStorage.getItem("ratioDetail"));
    console.log(this.contentData);
  },
  computed: {},
  methods: {
    selectClick(node, data) {
      console.log(this.$refs.tree.getCheckedKeys());
      this.getCheckedKeys = this.$refs.tree.getCheckedKeys();
      let that = this;
      this.ratioList.forEach(function(item, index, arr) {
        Object.assign(item, that.contentData[index]);
      });
      //   this.ratioList.map(item =>
      //     this.$set(
      //       item,
      //       getCheckedKeys[0],
      //       this.contentData[0][getCheckedKeys[0]]
      //     )
      //   );
      console.log(this.ratioList);
      //   this.ratioList.children = this.contentData;
      //   this.contentData.map(item => item)
    }
  }
};
</script>
<style lang="scss" scoped>
// 公共
$main-color: #303133;
$blue-color: #2d54b8;
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.el-dropdown-menu__item {
  font-size: 14px;
}
.list-container {
  background-color: #f7f7f7;
  font-size: 16px;
  color: $main-color;
  margin-top: 20px;
  min-height: 100%;
  position: relative;
  overflow: hidden;
}
.list-main {
  margin: 0 auto;
  width: 1200px;
  overflow: hidden;
  height: calc(100vh - 187px);
}
.biaozhumc {
  width: 120px;
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-sizing: border-box;
  padding-left: 15px;
}
.list-nav {
  border-left: 6px solid $blue-color;
  border-bottom: 1px solid #dcdcdc;
  border-radius: 4px;
  font-size: 18px;
  width: 250px;
  float: left;
  .list-nav-title {
    border-radius: 0 4px 0 0;
    border-right: 10px solid #fb9437;
    background-color: $blue-color;
    color: #ffffff;
    padding: 0 10px 0 15px;
    height: 46px;
    line-height: 46px;
    span {
      float: left;
    }
    i {
      float: right;
      font-size: 18px;
      height: 46px;
      line-height: 46px;
    }
  }
}
.list-menu {
  border-radius: 4px;
  border-right: 1px solid #dcdfe6;
  background-color: #ffffff;
  .el-submenu__title {
    padding: 0 13px 0 15px !important;
    background-color: #ebeef5;
    color: $blue-color;
    font-size: 16px;
  }
  .el-submenu__title i {
    color: $blue-color;
  }
  .el-submenu__icon-arrow {
    font-weight: 700;
  }
  .el-menu-item-group__title {
    padding: 0;
  }
  .el-submenu {
    margin-bottom: 1px;
    background: #ebeef5;
    &:last-child {
      margin-bottom: 0;
    }
    .el-menu-item {
      height: 46px;
      line-height: 46px;
      padding: 0 !important;
      p {
        margin: 0 0 0 15px;
        border-bottom: 1px solid #e4e7ed;
        padding: 0 13px 0 0;
      }
      &:last-child {
        border-bottom: 0;
      }
      &:focus,
      &:hover {
        p {
          border-bottom: 1px solid #ecf5ff;
        }
      }
      span {
        float: right;
        background-color: $blue-color;
        height: 24px;
        line-height: 24px;
        padding: 0 4px;
        color: #ffffff;
        border-radius: 4px;
        margin-top: 11px;
      }
    }
  }
}

.content {
  width: 900px;
  height: 100%;
  float: right;
  border: 1px solid #f5f5f5;
  overflow-y: auto;
  overflow-x: hidden;
  .contentCon {
    width: 900px;
    height: 100%;
    float: left;
    .contentTitleCon {
      width: 48px;
      height: 300px;
      float: left;
      .spaceCon {
        height: 124px;
        background: #fff;
        border: 1px solid #dcdcdc;
      }
      .contentTitle {
        width: 48px;
        height: 300px;
        float: left;
        padding-left: 15px;
        writing-mode: vertical-lr;
        text-align: center;
        background: #eaeef9;
        border: 1px solid #dcdcdc;
      }
    }

    .contentItem {
      width: 233px;
      height: auto;
      float: left;
      .contentItemTitle {
        width: 100%;
        height: 34px;
        line-height: 34px;
        text-align: center;
        background: #ebeef5;
      }
      .contentItemShow {
        border-right: 1px solid #dcdcdc;
        height: 90px;
        width: 100%;
        background-color: #fff;
        position: relative;
        padding: 20px 20px 0 20px;
        box-sizing: border-box;
        display: inline-block;
        margin-right: 20px;
        display: flex;
        justify-content: flex-start;
        flex-direction: column;
        align-items: center;
        .msg {
          width: 100%;
          font-size: 14px;
          color: #909399;
          span {
            display: inline-block;
          }
          .left {
            color: #000;
            font-size: 14px;
            font-weight: bold;
            width: 70px;
            text-align: right;
            margin-bottom: 10px;
          }
          .right {
          }
        }
      }
      .contentItemTxt {
        width: 100%;
        height: 300px;
        min-height: 300px;
        overflow-y: auto;
        overflow-x: hidden;
        border: 1px solid #dcdcdc;
        word-wrap: break-all;
        word-break: normal;
      }
    }
  }
}
</style>
